package com.company.class3;

/**
 * @Classname GaussCalc
 * @Description 类型说明
 * @Date 2022/4/17 17:36
 * @Created by zbw
 */

public class GaussCalc {
    public static void main(String[] args) {
        //用sum记录求和结果
        int sum = 0;
        for(int i =1;i<=100;i++){
            sum += i;
            System.out.println("前"+i+"个数相加的结果是"+sum);
        }
        System.out.println("最终结果是"+sum);

//        int[] a = {3,1,2};
//        int[] b = a;
//        b[0] = 30;
//        System.out.println(a);
//        System.out.println(b);
        //求100以内能被7整除的数
        for (int i = 1;i <= 100;i++){
            //循环操作是，用7除这个数，看是否能除尽
            if(i%7 == 0){
                System.out.print(i+",");
            }
        }
    }
}
